home *** CD-ROM | disk | FTP | other *** search
/ Images 3D / Images 3D.iso / aawin.cp / AAPLAY.H < prev    next >
C/C++ Source or Header  |  1991-07-26  |  17KB  |  463 lines

  1. /*
  2.  *  aaplay.h
  3.  *
  4.  *    Copyright (C) 1990, Autodesk, Inc.
  5.  *
  6.  *  This file contains the public definitions for AAPLAY.DLL. This file
  7.  *  should be included by applications that use AAPLAY.DLL.
  8.  */
  9.  
  10. #ifndef AAPLAY_INCLUDE
  11. #define AAPLAY_INCLUDE
  12.  
  13. #define    AAEXPORT _export
  14.  
  15. typedef WORD        HAA;        /* Handle to an animation */
  16.  
  17. /*
  18.  *  Type that holds speed for animation.
  19.  */
  20. typedef WORD        AASPEED;
  21.  
  22. /*
  23.  *  Type that holds transition for animation.
  24.  */
  25. typedef WORD        AATRN;
  26.  
  27. /*
  28.  *  AAOpen and AAClose are not really needed, except there is
  29.  *  a bug in Windows which prevents Libraries from being
  30.  *  freed in the Windows Exit Proc (WEP). So we use AAClose
  31.  *  to free the Libraries when the last task closes the
  32.  *  AAPlay DLL.
  33.  */
  34. BOOL FAR AAEXPORT PASCAL aaOpen(void);
  35. void FAR AAEXPORT PASCAL aaClose(void);
  36.  
  37. /*
  38.  *  aaLoad loads an animation. The file name is in lpzFileName
  39.  *  and the loading mode is in wMode.
  40.  */
  41. HAA FAR AAEXPORT PASCAL aaLoad(LPSTR lpzFileName, HWND hWnd, WORD wMode,
  42.     int x, int y, int width, int height, int orgx, int orgy);
  43.  
  44. /*
  45.  *  aaReLoad will load a new animation file into an old animation
  46.  *  handle. Notifications are lost, but the palette and window are
  47.  *  retained.
  48.  */
  49. BOOL FAR AAEXPORT PASCAL aaReLoad(HAA hAa, LPSTR lpzFileName, WORD wMode, WORD wMask);
  50.  
  51. /*
  52.  *  Valid flags in wMode. The low order eight bits of wMode
  53.  *  is used in aa_flags.
  54.  */
  55. #define AA_MEMORYLOAD        0x0001    /* Load into memory */
  56. #define AA_HIDEWINDOW        0x0002    /* Hide the animation window */
  57. #define AA_NOPALETTE        0x0004    /* Prevent palette animation */
  58. #define AA_RESERVEPALETTE    0x0008    /* Reserve entire palette at start */
  59. #define AA_LOOPFRAME        0x0010    /* Loaded with a loop frame */
  60. #define AA_FULLSCREEN        0x0020    /* Use full screen for playing */
  61. #define AA_STOPNOTIFY        0x0040    /* Prevent any notification messages */
  62. #define AA_STOPSTATUS        0x0080    /* Prevent status messages */
  63. #define AA_NOFAIL        0x0100    /* Reduce load type on fail */
  64. #define AA_DONTPAINT        0x0200    /* Don't paint animation when loading */
  65. #define AA_BUILDSCRIPT        0x0400    /* lpzFileName is script not name */
  66. #define AA_ALLMODES        0x00FF
  67.  
  68.  
  69. /*
  70.  *  aaUnload unloads a loaded animation. FALSE is returned if
  71.  *  hAa is not the handle of a loaded animation.
  72.  */
  73. BOOL FAR AAEXPORT PASCAL aaUnload(HAA hAa);
  74.  
  75. /*
  76.  *  aaSound will open or close a sound for the animation. The sound
  77.  *  is opened if the file arguement is not null and not blank,
  78.  *  otherwise the sound is closed. If device is null, the format
  79.  *  of the file is used to select an appropriate device.
  80.  */
  81. BOOL FAR AAEXPORT PASCAL aaSound(HAA hAa, LPSTR device, LPSTR file, WORD wMode);
  82.  
  83. /*
  84.  *  Valid flags for the sound mode.
  85.  */
  86. #define AA_SNDFREEZE        0x0001    /* Freeze frames until sound begins */
  87. #define AA_SNDDEVICEID        0x0100    /* device is an ID not a name */
  88. #define AA_SNDBUILDALIAS    0x0200    /* create sound device alias */
  89.  
  90. /*
  91.  *  aaPlay plays a loaded animation. TRUE is returned if the
  92.  *  animation is not stopped when aaPlay returns.
  93.  */
  94. BOOL FAR AAEXPORT PASCAL aaPlay(HAA hAa);
  95.  
  96.  
  97. /*
  98.  *  aaNotify allows an application to be notified at specific frames
  99.  *  when an animation is playing. lPosition is the position at which
  100.  *  the notification is to take place. The wParam for this message is
  101.  *  hAa, and the lParam is copied from this call. Returns TRUE if the
  102.  *  notification is set.
  103.  */
  104. BOOL FAR AAEXPORT PASCAL aaNotify(HAA hAa, DWORD lPosition, DWORD lParam);
  105.  
  106. #define AA_LONGPOS(l,f)        MAKELONG(f,l)
  107. #define AA_POSLOOPS(l)        HIWORD(l)
  108. #define AA_POSFRAME(l)        LOWORD(l)
  109.  
  110. /*
  111.  *  This value for the loops will cause the animation to end when
  112.  *  the sound has finished. If no sound is playing, the animation
  113.  *  will loop forever.
  114.  */
  115. #define AA_LOOPSOUND        0xFFFF
  116.  
  117. /*
  118.  *  An automatic notify is sent when an animation in a script is
  119.  *  reloaded. The lParam of this message is defined below
  120.  */
  121. #define AA_ANIMATIONLOADED    0L
  122.  
  123. /*
  124.  *  aaCancel allows an applicatin to cancel notifications set by aaNotify.
  125.  *  lLoPos and lHiPos give lower and upper limits on positions. Returns
  126.  *  the number of notifications canceled.
  127.  */
  128. WORD FAR AAEXPORT PASCAL aaCancel(HAA hAa, DWORD lLoPos, DWORD lHiPos);
  129.  
  130.  
  131. /*
  132.  *  aaStop will stop a playing animation. TRUE is returned if the
  133.  *  animation is stopped when aaStop returns.
  134.  */
  135. BOOL FAR AAEXPORT PASCAL aaStop(HAA hAa);
  136.  
  137.  
  138. /*
  139.  *  aaPause will pause an animation. TRUE is returned if the animation
  140.  *  is paused when aaPause returns. To resume a paused animation, use
  141.  *  aaPlay.
  142.  */
  143. BOOL FAR AAEXPORT PASCAL aaPause(HAA hAa);
  144.  
  145.  
  146. /*
  147.  *  aaPrompt will produce a dialog to prompt for user input. When
  148.  *  input is accepted, the handle is changed to reflect the new
  149.  *  parameters. The old handle is not destroyed until the new handle
  150.  *  has been created. aaPrompt returns NULL if the new handle cannot
  151.  *  be created, otherwise the new handle is returned.
  152.  */
  153. BOOL FAR AAEXPORT PASCAL aaPrompt(HAA hAa, LPSTR lpName);
  154.  
  155.  
  156. /*
  157.  *  The parameter structure to be used for the animation.
  158.  */
  159. typedef struct {
  160.     BYTE    aa_status;    /*  Current status of animation */
  161.     BYTE    aa_filetype;    /*  Type of file on disk  */
  162.     BYTE    aa_mode;    /*  Some flags */
  163.     BYTE    aa_bitpix;    /*  bits per pixel */
  164.  
  165.     HWND    aa_window;    /*  Handle of window for status messages */
  166.     int        aa_x,        /*  Left of display window */
  167.         aa_y,        /*  Top of display window */
  168.         aa_cx,        /*  Width of display window */
  169.         aa_cy;        /*  Height of display window */
  170.     int        aa_orgx,    /*  Point in the animation displayed */
  171.         aa_orgy;    /*  in the upper left corner */
  172.  
  173.     AASPEED    aa_speed;    /*  Speed of animation, msec per frame */
  174.     AASPEED    aa_designspeed;    /*  Designed milliseconds per frame */
  175.  
  176.     WORD    aa_width;    /*  Width of animation in pixels */
  177.     WORD    aa_height;    /*  Height of animation in pixels */
  178.  
  179.     WORD    aa_frames;    /*  Number of frames in animation */
  180.  
  181.     DWORD    aa_position;    /*  Current frame position */
  182.     DWORD    aa_loops;    /*  End of animation position */
  183.     WORD    aa_rptsound;    /*  Number of times to repeat sound */
  184.     WORD    aa_pause;    /*  Number of milliseconds to hold last frame */
  185.     LONG    aa_delaysnd;    /*  Delay Sound in milliseconds  */
  186.     BYTE    aa_transin;    /*  Transition at start of animation */
  187.     BYTE    aa_transout;    /*  Transition at end of animation */
  188.     WORD    aa_timein;    /*  Length of transition in, milliseconds */
  189.     WORD    aa_timeout;    /*  Length of transition out, milliseconds */
  190.     HWND    aa_callback;    /*  message callback window  */
  191.     HWND    aa_animwnd;    /*  Animation Window Handle */
  192. } AAPARMS, FAR *LPAAPARMS;
  193.  
  194.  
  195. /*
  196.  *  aaGetParm will return information on an animation. Some of the
  197.  *  information can be set with aaSetParm, and other information is
  198.  *  state information maintined by AAPLAY.
  199.  */
  200. DWORD FAR AAEXPORT PASCAL aaGetParm(HAA hAa, WORD wType);
  201.  
  202. /*
  203.  *  aaGetParmIndirect returns the same information as aaGetParm, in a
  204.  *  structure for easy access by C applications.
  205.  */
  206. BOOL FAR AAEXPORT PASCAL aaGetParmIndirect(HAA hAa, LPAAPARMS lpAp, WORD wSize);
  207.  
  208.  
  209. /*
  210.  *  aaSetParm will set information on an animation
  211.  */
  212. BOOL FAR AAEXPORT PASCAL aaSetParm(HAA hAa, WORD wType, WORD wValue1, DWORD lValue2);
  213.  
  214. /*
  215.  *  aaSetParmIndirect will set animation parameters from a structure
  216.  */
  217. BOOL FAR AAEXPORT PASCAL aaSetParmIndirect(HAA hAa, DWORD dwType, LPAAPARMS lpAp,
  218.     WORD wMask);
  219.  
  220.  
  221. /*
  222.  *  The parameter types that can be used with aaGetParm, and aaSetParm.
  223.  */
  224. #define AA_STATUS          1    /* Get current status */
  225. #define AA_FILETYPE          2    /* Get Type of animation on disk */
  226. #define AA_MODE              3    /* Get/Set Animation Flags */
  227. #define AA_WINDOW          4    /* Set/Get animation window */
  228. #define AA_SPEED          5    /* Set/Get current speed */
  229. #define AA_DESIGNSPEED          6    /* Get design speed */
  230. #define AA_FRAMES          7    /* Get Number of frames */
  231. #define AA_POSITION          8    /* Set/Get current frame position */
  232. #define AA_LOOPS          9    /* Set/Get number of loops */
  233. #define AA_X             10    /* Set/Get Pos of display window */
  234. #define AA_Y             11    /* Set/Get Pos of display window */
  235. #define AA_CX             12    /* Set/Get extents of display window */
  236. #define AA_CY             13    /* Set/Get extents of display window */
  237. #define AA_ORGX             14    /* Set/Get Origin of display window */
  238. #define AA_ORGY             15    /* Set/Get Origin of display window */
  239. #define AA_WIDTH         16    /* Get Width of animation */
  240. #define AA_HEIGHT         17    /* Get Height of animation */
  241. #define AA_RPTSOUND         18    /* Set/Get sound repeats */
  242. #define AA_PAUSE         19    /* Set/Get pause time */
  243. #define AA_DELAYSND         20    /* Set/Get sound delay time */
  244. #define AA_TRANSIN         21    /* Set/Get Transition In type */
  245. #define AA_TRANSOUT         22    /* Set/Get Transition Out type */
  246. #define AA_TIMEIN         23    /* Set/Get Transition In time */
  247. #define AA_TIMEOUT         24    /* Set/Get Transition Out Time */
  248. #define AA_CALLBACK         25    /* Set/Get CallBack window */
  249. #define AA_ANIMWND         26    /* Get Animation Window Handle */
  250. #define AA_MODFLAG        100    /* Set/Get Script is modified flag */
  251. #define AA_SCRIPTNAME        101    /* Set/Get Script name */
  252. #define AA_ANIMATION        102    /* Get/Set Script Animation */
  253. #define AA_ANIMATIONCOUNT    103    /* Get Script Animation Count */
  254. #define AA_SCRIPTCONTENTS    104    /* Get Script Contents */
  255. #define AA_LASTERROR           1001    /* Get last error code */
  256. #define AA_LASTERRORMESSAGE    1002    /* Get/Set last error messsage */
  257.  
  258.  
  259. /*
  260.  *  The parameter type that can be used with aaSetParmIndirect
  261.  */
  262. #define AA_SETMODE    0x00000001UL    /* Get/Set Animation Flags */
  263. #define AA_SETWINDOW    0x00000002UL    /* Set/Get animation window */
  264. #define AA_SETSPEED    0x00000004UL    /* Set/Get current speed */
  265. #define AA_SETPOSITION    0x00000008UL    /* Set/Get current frame position */
  266. #define AA_SETLOOPS    0x00000010UL    /* Set/Get number of loops */
  267. #define AA_SETX        0x00000020UL    /* Set/Get left of display window */
  268. #define AA_SETY        0x00000040UL    /* Set/Get left of display window */
  269. #define AA_SETCX    0x00000080UL    /* Set/Get top of display window */
  270. #define AA_SETCY    0x00000100UL    /* Set/Get top of display window */
  271. #define AA_SETORGX    0x00000200UL    /* Set/Get width of display window */
  272. #define AA_SETORGY    0x00000400UL    /* Set/Get width of display window */
  273. #define AA_SETRPTSOUND    0x00000800UL    /* Set/Get sound repeats */
  274. #define AA_SETPAUSE    0x00001000UL    /* Set/Get pause time */
  275. #define AA_SETDELAYSND    0x00002000UL     /* Set/Get sound delay time */
  276. #define AA_SETTRANSIN    0x00004000UL    /* Set/Get Transition In type */
  277. #define AA_SETTRANSOUT    0x00008000UL    /* Set/Get Transition Out type */
  278. #define AA_SETTIMEIN    0x00010000UL    /* Set/Get Transition In time */
  279. #define AA_SETTIMEOUT    0x00020000UL    /* Set/Get Transition Out Time */
  280. #define AA_SETCALLBACK    0x00040000UL    /* Set/Get Callback window */
  281. #define AA_ALL        0xFFFFFFFFUL    /* Get/Set all parameters */
  282.  
  283.  
  284. /*
  285.  *  Status values for an animation
  286.  */
  287. #define AA_STOPPED         1    /* Loaded but not playing */
  288. #define AA_QUEUED         2    /* Animation is waiting to play */
  289. #define AA_PLAYING         3    /* Animation is playing */
  290. #define AA_PAUSED         4    /* Animation is paused */
  291. #define AA_DONE             5    /* Animation has ended playing,
  292.                        and is awaiting an aaStop call */
  293.  
  294.  
  295. /*
  296.  *  File type definitions
  297.  */
  298. #define AA_FLI            0x01    /* Autodesk Animator Fli format */
  299. #define AA_DIB            0x02    /* Windows DIB format */
  300. #define AA_NUMTYPES        0x02    /* Number of types */
  301. #define AA_SCRIPT        0x03    /* Script without an animation */
  302.  
  303. /*
  304.  *  Transition types
  305.  */
  306. #define AA_CUT            0x00    /* Just stop one and start another */
  307. #define AA_FADEBLACK        0x01    /* Fade In/Out from to black */
  308. #define AA_FADEWHITE        0x02    /* Fade In/Out from to white */
  309.  
  310.  
  311. /*
  312.  *  Error codes returned by aaGetParm(xxx, AA_LASTERROR)
  313.  */
  314. #define AA_ERR_NOERROR            0x0000    /*  Unknown error */
  315.  
  316. #define AA_ERR_NOMEMORY            0x0100    /*  Out of memory error */
  317. #define AA_ERR_BADHANDLE        0x0101    /*  Bad handle */
  318. #define AA_ERR_NOTIMERS            0x0102    /*  Cannot start timer */
  319. #define AA_ERR_BADSOUND            0x0103    /*  Bad sound spec */
  320. #define AA_ERR_NOSCRIPT            0x0104    /*  Requires a script */
  321. #define AA_ERR_WRITEERR            0x0105    /*  Write error for script */
  322. #define AA_ERR_BADANIMATION        0x0106  /*  Can not opem animation */
  323.  
  324. #define AA_ERR_BADWINDOWHANDLE        0x0200    /*  Bad Window Handle */
  325. #define AA_ERR_WINDOWCREATE        0x0201    /*  Cannot create window */
  326. #define AA_ERR_DLGERROR            0x0202    /*  Dialog error */
  327.  
  328. #define AA_ERR_INVALIDSTATUS        0x0300    /*  Invalid status */
  329. #define AA_ERR_BADDIBFORMAT        0x0301    /*  Bad dib file */
  330. #define AA_ERR_BADFLIFORMAT        0x0302    /*  Bad fli file */
  331. #define AA_ERR_UNRECOGNIZEDFORMAT    0x0303    /*  Unrecognized format */
  332. #define AA_ERR_NOSOUND            0x0304    /*  Sound not supported */
  333. #define AA_ERR_NOTVALIDFORSCRIPTS    0x0305    /*  Not valid for scripts */
  334. #define AA_ERR_INVALIDFILE        0x0306    /*  Bad file handle */
  335. #define AA_ERR_NOSCRIPTS        0x0307    /*  No Script files */
  336.  
  337. #define AA_ERR_SPEED            0x0400    /*  Invalid speed */
  338. #define AA_ERR_LOOPS            0x0401    /*  invalid loops */
  339. #define AA_ERR_RPTSOUND            0x0402    /*  invalid repeat sound */
  340. #define AA_ERR_PAUSE            0x0403    /*  invalid pause */
  341. #define AA_ERR_TRANSIN            0x0404    /*  invalid transition */
  342. #define AA_ERR_TIMEIN            0x0405    /*  invalid transition */
  343. #define AA_ERR_TRANSOUT            0x0406    /*  invalid transition time */
  344. #define AA_ERR_TIMEOUT            0x0407    /*  invalid transition time */
  345. #define AA_ERR_DELAYSND            0x0408    /*  invalid sound delay */
  346. #define AA_ERR_INVALIDTYPE        0x0409    /*  invalid parameter type */
  347.  
  348. #define AA_ERR_DUPLICATENOTIFY        0x0500    /*  duplicate notify  */
  349.  
  350. #define AA_ERR_NOSWITCH            0x0600    /*  no switch in script */
  351. #define AA_ERR_PARSELOOPS        0x0601    /*  Bad loops in script */
  352. #define AA_ERR_PARSESPEED        0x0602    /*  Bad speed in script */
  353. #define AA_ERR_BADRPTSOUND        0x0603    /*  Bad repeat sound in script */
  354. #define AA_ERR_PARSEPAUSE        0x0604    /*  Bad pause in script */
  355. #define AA_ERR_PARSETRANS        0x0605    /*  Bad tranisition in script */
  356. #define AA_ERR_PARSEDELAYSND        0x0606    /*  Bad delay sound in script */
  357. #define AA_ERR_TOOMANYLINKS        0x0607  /*  Too many links */
  358.  
  359.  
  360. /*
  361.  *  aaShow will show a single frame of an animation in a window.
  362.  *  The mode determines how the animation is drawn. The window used
  363.  *  is set using either aaSetParm or aaSetParmIndirect. aaShow returns
  364.  *  TRUE if the animation was successfully drawn.
  365.  */
  366. BOOL FAR AAEXPORT PASCAL aaShow(HAA hAa, BOOL bShow);
  367.  
  368.  
  369. /* result = OpenFileDialog(wFlags, lpszPath, wBufLen, lpszDriver, wDrvLen)
  370.  *
  371.  * Opens a dialog box querying the user for a file in the standard windows
  372.  * file open box style.  <dwFlags> determines how the dialog box will appear.
  373.  * It may be the following:
  374.  *    AA_GETFILE_MUSTEXIST    Selected file must satisfy conditions of
  375.  *                OpenFile() flags, else dialog beeps.
  376.  *    AA_GETFILE_NOSHOWSPEC    DO NOT show the search spec in the edit box.
  377.  *                Default IS to show the spec.
  378.  *    AA_GETFILE_SAVE        Ok button will show "Save".
  379.  *    AA_GETFILE_OPEN        Ok button will show "Open".
  380.  *    AA_GETFILE_USEFILE    Set the filename to the file in lpszPath
  381.  *    AA_GETFILE_UDEDIR    Change to the directory in lpszPath
  382.  *    AA_GETFILE_SOUND    Get sound file and driver
  383.  *    AA_GETFILE_SCRIPT    Get script file
  384.  *    AA_GETFILE_ANIMATION    Get Animation File (no scripts)
  385.  *
  386.  * <lpszPath> is a LPSTR to a string buffer into which the final fully
  387.  * qualified pathname will be written.  <wBufLen> is the length of this
  388.  * buffer.
  389.  *
  390.  * <lpszDriver> is a LPSTR to a string buffer into which a sound device
  391.  * selection is placed. <wDrvLen> is the length of this buffer.
  392.  *
  393.  * Return value is:    0 if cancel was hit
  394.  *            -1 if OpenFile() failed but AA_GETFILE_MUSTEXIST was
  395.  *            not specified.
  396.  *            DOS file handle of selected file, otherwise. This
  397.  *                handle is not open when aaOpenFile returns.
  398.  */
  399.  
  400. int FAR AAEXPORT PASCAL aaGetFile(WORD dwFlags,          /* Flag values */
  401.                          LPSTR lpszPath,
  402.                          WORD  wBufLen,
  403.              LPSTR lpszDriver,          /* Selected item */
  404.              WORD  wDrvLen);          /* Length of buffer */
  405.  
  406. /*
  407.  *  flags:
  408.  *     can be any of the following
  409.  */
  410. #define AA_GETFILE_MUSTEXIST    0x0001
  411. #define AA_GETFILE_NOSHOWSPEC    0x0002
  412. #define AA_GETFILE_SAVE        0x0004
  413. #define AA_GETFILE_OPEN        0x0008
  414. #define AA_GETFILE_USEDIR    0x0010
  415. #define AA_GETFILE_USEFILE    0x0020
  416. #define AA_GETFILE_SOUND    0x0040
  417. #define AA_GETFILE_SCRIPT    0x0080
  418. #define AA_GETFILE_ANIMATION    0x0100
  419.  
  420. /*
  421.  *  Save a script
  422.  */
  423. int  FAR AAEXPORT PASCAL aaSave(HAA hAa, WORD wMode);
  424.  
  425. /*
  426.  *  wMode Values
  427.  */
  428. #define AA_SAVE_IFMODIFIED    0x0001
  429. #define AA_SAVE_AS        0x0002
  430. #define AA_SAVE_CANCEL        0x0004
  431.  
  432. /*
  433.  *  Get Capabitities
  434.  */
  435. WORD FAR AAEXPORT PASCAL aaGetCaps(WORD wType);
  436.  
  437. /*
  438.  * Capabitlities
  439.  */
  440. #define AA_CAP_TIMER         1
  441. #define AA_CAP_SOUND         2
  442. #define AA_CAP_SCRIPT         3
  443.  
  444. /*
  445.  *  Animation status messages
  446.  *  Use RegisterWindowMessage to get the real message
  447.  *  numbers.
  448.  */
  449. #define AA_NOTIFY        "AAPLAY Notify"    /* notification message */
  450. #define AA_STOP            "AAPLAY Stop"    /* stop message */
  451.  
  452. /*
  453.  *  These are sent in the low word of lParam with the AA_ERROR
  454.  *  message. They indicate the error that occured
  455.  */
  456. #define AA_BADPLAY        1    /* Error attempting to play */
  457. #define AA_BADNOTIFY        2    /* Error attempting to notify */
  458. #define AA_BADSCRIPT        3    /* Error attempting to animation
  459.                        in script */
  460.  
  461.  
  462. #endif /* AAPLAY_INCLUDE */
  463.